//品牌控制层
app.controller('brandController',function ($scope,brandService,$controller) {
    $controller('baseController',{$scope:$scope});//继承
    //读取到列表数据绑定到表单中

    $scope.SeachEntity={}
    $scope.findAll=function (page,size) {
       brandService.findAll(page,size,$scope.SeachEntity).success(function (response) {
            $scope.list=response.rows;
            $scope.paginationConf.totalItems=response.total;
        })
    }

    $scope.findOne=function (id) {
       brandService.findOne(id).success(function (response) {

            $scope.entity1=response;
        })
    }
    $scope.save=function () {

        var methodName='add';//方法名称
        if ($scope.entity1.id!=null){
            //如果有Id
            methodName='update';
        }
       brandService.save(methodName,$scope.entity1).success(function (response) {
            if (response.success){
                $scope.reloadList();//重新加载
            }else {
                alert(response.message);
            }
        })
    }

    $scope.dele=function () {
        //获取选中的复选框
      brandService.dele($scope.selectIds).success(function (response) {
            if (response.success){
                $scope.reloadList();
            }
        })
    }


})